package top.buluoluo.ordersservice.dto.respone;

import lombok.Data;
import top.buluoluo.ordersservice.entity.Orders;
import top.buluoluo.ordersservice.enums.OrderPaymentMethod;

import java.math.BigDecimal;
import java.util.Date;

@Data
public class OrderPayDTO {
    private String orderId;
    private Long userId;
    private OrderPaymentMethod paymentMethod;
    private BigDecimal payAmount;
    private Date paymentTime;

    public static  OrderPayDTO fromEntity(Orders orders){
        OrderPayDTO orderPayDTO = new OrderPayDTO();
        orderPayDTO.orderId = String.valueOf(orders.getId());
        orderPayDTO.paymentMethod = orders.getPaymentMethod();
        orderPayDTO.payAmount = orders.getFinalAmount();
        orderPayDTO.paymentTime = orders.getPaymentTime();
        orderPayDTO.userId = orders.getUserId();
        return orderPayDTO;
    }
}
